package io;

import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;

/**
 * 对象流是高级流，作用是进行对象的序列化与反序列化
 * 本案例演示序列化
 */
public class OosDemo {
    public static void main(String[] args) throws IOException {
        String name="马超明";
        int age=21;
        String gender="男";
        String[] otherInfo={"长春","他女朋友叫小田妹","他很帅","她很美"};
        Person person=new Person(name,age,gender,otherInfo);
        FileOutputStream fos=new FileOutputStream("person.obj");
        ObjectOutputStream oos=new ObjectOutputStream(fos);
        oos.writeObject(person);
        System.out.println("写出完毕");
        oos.close();
    }
}
